<%@page import="weaver.conn.RecordSet"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" import="com.zlgs.cqyf.vote.ConnectionUtil"%>
<%@ page import="java.io.PrintWriter" %>
<%@ page import="java.sql.ResultSet" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%
    response.setCharacterEncoding("UTF-8");
    response.setContentType("application/json; charset=utf-8");
    JSONObject retObject = new JSONObject();
    retObject.put("code", 200);
    retObject.put("msg", "操作成功");
    try {
        // URL 参数
        Object id  = request.getParameter("id");                  // 子奖项ID

        // 跟新数据
        String sql = "select * from vote_awards_subname where id="+id;
        RecordSet set = new RecordSet();
        set.executeQuery(sql);
        JSONObject jsonObject = new JSONObject();
        while(set.next()){
            jsonObject.put("id",set.getString("id"));                                     // 奖项配置id
            jsonObject.put("name",set.getString("name"));                               // 奖项配置名称
            jsonObject.put("awardsId",set.getString("awards_id"));                        // 奖项ID
            jsonObject.put("status",set.getString("status"));               // 奖项状态
            jsonObject.put("msgStatus",set.getString("msg_status"));                     // 消息发送状态
            jsonObject.put("isDel",set.getString("is_del"));                     // 是否删除
        }
        retObject.put("data", jsonObject);
    } catch (Exception e) {
        e.printStackTrace();
        retObject.put("code", -1);
        retObject.put("msg", e.getMessage());
    } finally {
        PrintWriter printWriter = response.getWriter();
        printWriter.append(retObject.toJSONString());
        if (printWriter != null)  printWriter.close();
    }
%>
 